Responsive Design & Media Queries

Build layouts that adapt to any screen size using media queries, fluid grids, and responsive units.

Category: Web Development · v1.0.0
Step 1 of 6

Step 1: What is Responsive Design?

Responsive design is the practice of building one codebase that adapts gracefully to every screen size — from a 320px phone to a 2560px ultra-wide monitor.

The foundation is the viewport meta tag, which tells the browser to match the device width instead of defaulting to a 980px-wide desktop layout:

<meta name="viewport"
      content="width=device-width, initial-scale=1.0">

Without this tag, mobile browsers zoom out to fit the full desktop layout, making text unreadable.

Key terms:

  • Viewport — the visible area of a web page in the browser window
  • Breakpoint — a specific viewport width where the layout changes (e.g. 768px)
  • Media query — a CSS rule that applies styles only when a condition is met (e.g. screen width ≥ 768px)
  • Mobile-first — writing base styles for small screens, then adding complexity via min-width queries
Why it matters: Over 60% of web traffic comes from mobile devices. A non-responsive site loses visitors and ranks lower in search results.

About This Lab

Responsive design ensures your website looks great on any device — from phones to ultra-wide monitors. In this lab, you'll learn about viewport units, media queries, breakpoints, mobile-first design, fluid typography, and responsive images through interactive demos with a resizable preview.

How It Works

  1. Read each step's explanation of responsive design concepts
  2. Drag the resizable preview to see layouts adapt
  3. Toggle between device sizes
  4. Write your own media queries
  5. Complete the quiz to test your understanding